package com.ruoyi.system.service.impl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.system.domain.entity.SysFileInfo;
import com.ruoyi.system.mapper.SysFileInfoMapper;
import com.ruoyi.system.service.ISysFileInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 附件Service业务层处理
 *
 * @author ruoyi
 * @date 2023-02-07
 */
@Service
public class SysFileInfoServiceImpl extends ServiceImpl<SysFileInfoMapper, SysFileInfo> implements ISysFileInfoService {

    @Autowired
    private SysFileInfoMapper sysFileInfoMapper;

    /**
     * 新增附件
     *
     * @param sysFileInfo 附件
     * @return 结果
     */
    @Override
    @Transactional
    public int insertSysFileInfo(SysFileInfo sysFileInfo)
    {
        sysFileInfo.setCreateTime(DateUtils.getNowDate());
        sysFileInfo.setCreateBy(SecurityUtils.getUsername());
        sysFileInfo.setStatus(UserConstants.NORMAL);
        return sysFileInfoMapper.insertSysFileInfo(sysFileInfo);
    }

}


